package net.jueb.frameworkDemo.se.observer.eventBus.test1;

import com.google.common.eventbus.Subscribe;

public class Observer2 {
    @Subscribe
    public void ob2Method1(String msg) {
    	 System.out.println("ob2Method1(String msg=" + msg);
    }

    // 错误的基本型参数
    // @Subscribe
    // public void ob2Method2(int msg) {
    // System.out.println(msg + " test4!");
    // }
    /**
     * post() 不支持自动装箱功能,只能使用Integer,不能使用int,否则handlersByType的Class会是int而不是Intege
     * 而传入的int msg参数在post(int msg)的时候会被包装成Integer,导致无法匹配到
     */
    
    @Subscribe
    public void ob2Method2(Integer msg) {
        System.out.println("Observer2 ob2Method2(Integer msg=" + msg);
    }
    
    @Subscribe
    public void ob2Method2(int msg) {
        System.out.println("Observer2 ob2Method2(int msg=" + msg);
    }
    
    @Subscribe
    public void ob2Method2(short msg) {
        System.out.println("Observer2 ob2Method2(short msg=" + msg);
    }
}



